home *** CD-ROM | disk | FTP | other *** search
- Path: aimnet.aimnet.com!not-for-mail
- From: krisb@aimnet.com (Kris Bosland)
- Newsgroups: comp.lang.c++
- Subject: Template Troubles
- Date: 25 Feb 1996 20:11:23 -0800
- Organization: Aimnet Corp.
- Distribution: usa
- Message-ID: <4grbtb$nog@aimnet.aimnet.com>
- NNTP-Posting-Host: aimnet.aimnet.com
-
- I have just discovered Templates in C++, and I am trying to use them
- for the same thing that everyone else uses them for: Linked Lists. I am
- trying to get even a basic template class going, and it is not working. I am
- running g++ 2.7.0 on my Linux 1.2.13 system (vanilla Slackware 3.0). Files:
-
- test.cc:
- ----------------------------------------------------------------
- template <class data_t> class List {
- public:
- data_t data;
- }
-
- void main( int argc, char **argv )
- {
- List<char *> string_list;
-
- }
- ----------------------------------------------------------------
-
- Compiler Results:
- ----------------------------------------------------------------
- g++ -g -o test test.cc
- test.cc:7: parse error before `void'
- test.cc:9: confused by earlier errors, bailing out
- make: *** [test] Error 1
- ----------------------------------------------------------------
-
- Could I be missing some compiler flags or configuration? I don't have
- much experience customizing gcc/g++. In a more complicated file I wrote, I
- got errors complaining about incomplete typing of the data member of my class.
-
-
-
- -Kris Bosland
- krisb@aimnet.com
- http://www.seattleu.edu/~krisb/
-